//
//  MallShopSecondTableViewCell.m
//  BaseFrame
//
//  Created by 吕金状 on 2017/8/21.
//  Copyright © 2017年 com.mxh. All rights reserved.
//

#import "MallShopSecondTableViewCell.h"

@interface MallShopSecondTableViewCell ()

Strong UILabel *titleLabel;
Strong UIImageView *titleImageView;

@end

@implementation MallShopSecondTableViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        _titleLabel  = [[UILabel alloc]init];
        _titleLabel.font = DEF_FontSize_14;
        _titleLabel.textColor = getColor(textColor);
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_titleLabel];
        
        _titleImageView = [UIImageView new];
        _titleImageView.contentMode = UIViewContentModeScaleAspectFit;
        
        [self.contentView addSubview:_titleImageView];
        
    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.titleImageView.frame = CGRectMake(20 / WIDTH_5S_SCALE, 20 / WIDTH_5S_SCALE, self.width - 40 / WIDTH_5S_SCALE, self.width - 40 / WIDTH_5S_SCALE);
    self.titleLabel.frame = CGRectMake(0, self.width - 40 / WIDTH_5S_SCALE + 20 / WIDTH_5S_SCALE, self.width, self.height - (self.width - 40 / WIDTH_5S_SCALE + 20 / WIDTH_5S_SCALE));
    
}

- (void)setModel:(NSDictionary *)model{
    _model = model;
    self.titleLabel.text = model[@"tlm_name"];
    [self.titleImageView sd_setImageWithURL:[NSURL URLOffsetIPWithString:model[@"tlm_picture_path"]]];
}

@end
